package com.be.beadmin.system;

import com.be.beadmin.service.impl.MinioService;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.IOException;
import java.io.InputStream;

/**
 * @Description:
 * @author: Jiaming Zheng
 * @Date: Create in 12:27 2023/5/15
 * @Modified By:
 **/
@SpringBootTest
@RunWith(SpringRunner.class)
public class BomAnaluze {

    @Autowired
    private MinioService minioService;
    @Test
    public void getBom(){

        InputStream inputStream = minioService.downloadOne("standfile", "STD.OTHERS.002.0025+Bom模板 - 副本.xlsx");
        Workbook workbook = null;
        try {
            workbook = new XSSFWorkbook(inputStream);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        Sheet sheet = workbook.getSheetAt(0);
        for (Row row:sheet) {
            System.out.println(row.getCell(0));
            System.out.println(row.getCell(1));
            System.out.println(row.getCell(2));
            System.out.println(row.getCell(3));
        }

    }
}
